package com.execl.controller;

import com.execl.entity.Execl;
import com.execl.utils.result.ResultUtil;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.execl.utils.result.BaseResult;
import java.util.List;

@RestController
@RequestMapping("/api")
public class ExeclController {


    private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(ExeclController.class);
    @Autowired
    private com.execl.service.ExeclServices ExeclServices;

    @RequestMapping(value = "/hello", method = RequestMethod.GET)
    public String hello() {
        return  "Hello";
    }
    @RequestMapping(value = "/find", method = RequestMethod.GET)
    public BaseResult statusSwitch(String name, PageInfo pageInfo) {

        if (StringUtil.isNotEmpty(name.trim())) {
          List<Execl> execlList = ExeclServices.findUser(name.trim(),pageInfo);
            return ResultUtil.success("查找成功", execlList);
        }
            return ResultUtil.error(-316, "参数错误");

    }


}
